home *** CD-ROM | disk | FTP | other *** search
- Path: crl.crl.com!not-for-mail
- From: bobfry@crl.com (Robert Fry)
- Newsgroups: comp.lang.c
- Subject: Re: Packing characters
- Date: 8 Jan 1996 09:05:46 -0800
- Organization: CRL Dialup Internet Access
- Message-ID: <4crita$ek@crl.crl.com>
- References: <4cp6st$phk@news.isc.rit.edu>
- NNTP-Posting-Host: crl.com
-
- css0958@osfmail.isc.rit.edu (SWANSON) writes:
-
- >Problem: I have a value like this: XXX.YYY where the X and Y's
- >are numbers, like in an ip address. The values are 0-255.
-
- >What is the best way to store them so they take up the least
- >amount of room? Later I need to traansmit them in a packet
- >header, so space is an issue.
-
- Personally, I don't feel that 'the best way to store' a value is
- necessarily the way that takes the 'least amount of room'. In this case,
- that may be true, but it is never necessarily so.
-
- If you're sure the numbers will always be 0-255, why not declare a
- structure with room for an unsigned char for each number?
-
- Bob
-